home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: weather@netside.com (Russ Weathersby)
- Newsgroups: comp.std.c,comp.lang.c.moderated
- Subject: Re: Integral promotion.
- Date: 24 Feb 1996 09:44:46 -0600
- Organization: The Netside Network
- Sender: clc@solutions.solon.com
- Approved: clc@solutions.solon.com
- Message-ID: <4gnbpe$bmv@solutions.solon.com>
- References: <4fstj7$2l6@solutions.solon.com> <4fvgvb$e0t@solutions.solon.com> <4gfgfp$3k8@solutions.solon.com> <4gjd3g$nt9@solutions.solon.com>
- Reply-To: weather@netside.com (Russ Weathersby)
- NNTP-Posting-Host: solutions.solon.com
- X-Newsreader: IBM NewsReader/2 v1.2
-
- In <4gjd3g$nt9@solutions.solon.com>, encom@jolt.mpx.com.au (Encom Technology Sydney) writes:
- :Re: short = short + short causing a warning.
- :
- :This is all getting off the track. Since only a warning is generated this
- :has very little to do with the standard. I think the point is why does
- :
- :short = short + short;
- :
- :generate a warning whereas
- :
- :int = int + int;
- :
- :does not. Both these statements are as prone to overflow as each other
- :(although in the first case it may not happen until the int resulting
- :from the addition is moved into the short if sizeof(int) > sizeof(short).
- :
- :The warning is even sillier since on the implementation mentioned
- :ints and shorts are the same.
-
- I do not own, nor have I read, a copy of the ANSI standard. That said,
- ints in my experience have 'special status' in that it is usually the
- machine word size, sort of like an atomic data unit, whereas shorts
- are an artificial construction. Even though the two have the same size
- in the example, this may nevertheless influence the behavior of the
- compiler.
-
- R.Weathersby
-